<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/** 封闭模块 **/
Route::middleware('authorization:api')->group(function (){
    // 用户模块
    Route::prefix('user')->group(function (){
        // 用户信息
        Route::get('info/{id?}', 'UserController@show');
        // 更新用户
        Route::post('update/{id?}', 'UserController@update');
    });
    // 配置管理
    Route::prefix('config')->group(function (){
        // 获取配置
        Route::match(['get','post'], '/get', 'ConfigController@keyBy');
    });
    // 商品模块
    Route::prefix('goods')->group(function (){
        Route::post('store', 'GoodsController@store');
        Route::get('paginate', 'GoodsController@index');
        Route::get('info/{id?}', 'GoodsController@show');
    });
    // 投标模块
    Route::prefix('bid')->group(function (){
        // 获取当前激活场次
        Route::get('active', 'BidController@showActive');

        // 投标竞价模块
        Route::prefix('goods')->group(function () {
            // 创建
            Route::post('store', 'BidGoodsController@store');
            // 标签列表
            Route::get('paginate', 'BidGoodsController@index');
        });
    });
    // 货主模块
    Route::prefix('supplier')->group(function (){
        // 列表
        Route::get('paginate', 'SupplierController@index');
    });
});
